import 'package:flutter/material.dart';
import 'package:todo_list/components/base/neu_box.dart';

class SettingDrawer extends StatelessWidget {
  const SettingDrawer({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Drawer(
        backgroundColor: Colors.grey[350],
        width: MediaQuery.of(context).size.width * 0.4,
        child: ListView(
          children: [
            Center(
              child: Container(
                margin: const EdgeInsets.symmetric(vertical: 15),
                child: const Text(
                  "设置",
                  style: TextStyle(color: Colors.black87, fontSize: 18),
                ),
              ),
            ),
            const MenuItem("测试一", icon: Icon(Icons.access_alarm_outlined),)
          ],
        ),
      ),
    );
  }
}

class MenuItem extends StatelessWidget {
  final String name;
  final Icon? icon;

  const MenuItem(this.name, {Key? key, this.icon}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: (){},
      child: Container(
        color: Colors.grey[300],
        height: 40,
        padding: const EdgeInsets.symmetric(vertical: 8),
        margin: const EdgeInsets.symmetric(vertical: 1),
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Container(
              margin: const EdgeInsets.fromLTRB(10, 0, 15, 0),
              child: icon,
            ),
            Text(
              name,
              style: const TextStyle(color: Colors.black54, fontSize: 15),
            )
          ],
        ),
      ),
    );
  }
}
